< previous page page_66 next page >

Page 66
This code displays the Contents page for the Crystal Reports help file that comes with Visual Basic. When it's displayed, users are in the standard Windows help application and can navigate to any area of the help file that they need to go.
Using the Dialog Automation Objects
Now that you've seen how to use VB's Common Dialog control, I want to show you another way of performing the set of functions without using this control. One tool included on Visual Basic's CD-ROM is the Microsoft Dialog Automation Objects component. This component provides the common dialog functionality without requiring that you place a control on a form.
To incorporate this object in your application, you first need to install it on your computer:
1. Copy DLGOBJS.DLL from the COMMON\TOOLS\VB\UNSUPPRT\DLGOBJ directory into your \WINDOWS\SYSTEM directory.
2. Register the design-time license for the object by merging the DLGOBJS.REG Registry file into your Registry file. (While in Explorer, right-click COMMON\TOOLS\VB\UNSUPPRT\DLGOBJ\DLGOBJS.REG and choose Merge from the menu.)
3. When the object is registered, select Microsoft Dialog Automation Objects in the Project References dialog box within the Visual Basic environment.
To access the dialog object, you need to define it in the application. Unlike the Common Dialog control, however, you need to define a different object for each function that you want to use. To use the Open and Save As dialog boxes, add the following line of code in the General area of the form:
Dim FileDialog as New DialogObjects.ChooseFile
This code will give you only the Open and Save As functionality. Open the dlgFileOpenCopy project that you modified earlier today and change the code in the cmdSourceFile_Click routine to this:
Private Sub cmdSourceFile_Click()
    dlgFileSelect.Flags = cdlOFNFileMustExist
    FileDialog.Save = False
    FileDialog.Center = True
    FileDialog.Directory = c:\temp
    FileDialog.Title = Custom File Selection
    FileDialog.Show
   dlgFileSelect.ShowOpen

 
< previous page page_66 next page >

If you like this book, buy it!